<ui:composition template="/WEB-INF/templates/main-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
	
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
		<h:form>
		 
		<p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>  
              
		<p:dialog modal="true" widgetVar="statusDialog" showHeader="false"   
		        draggable="false" closable="false">  
		    <p:graphicImage value="/resources/styles/images/ajax-loading-bar.gif" />  
		</p:dialog> 
	  
		
		<h:panelGrid columns="3" style="width: 450px; "  columnClasses="gridCellButtomLeftAligned, gridCellButtomLeftAligned, gridCellButtomLeftAligned">
				   <h:outputText value="Leave balance report" styleClass="outputTextTitle"/>
				   <h:outputText value=":"/>
				  <h:panelGroup>    
				  <h:outputText value="" />
					<br />
					 <p:commandButton  value="VEIW and EXPORT TO EXCEL" actionListener="#{employeeLeaveBalances.searchActionListener}" update="@form"/>
				  </h:panelGroup>
			</h:panelGrid>	  

			<h:panelGrid style="width: 100%">	
			
		         <h:panelGrid style="width: 100%">
				<p:commandButton value="Download as excel file" ajax="false" rendered="#{employeeLeaveBalances.RENDERTABLE}" style="float: right;">
							 <p:dataExporter target="leaveBalance" type="xls" fileName="EMPLEAVEBALANCES-#{employeeLeaveBalances.selectedMonth+1}-#{employeeLeaveBalances.selectedYear}"></p:dataExporter>
							</p:commandButton>
		        </h:panelGrid>
		                 <p:dataTable id="leaveBalance" style="width: 100%" value="#{employeeLeaveBalances.employeeAttendances}"								
									 var="employeeAttendance" rendered="#{employeeLeaveBalances.RENDERTABLE}">
									<p:column>
										<f:facet name="header">
											<h:outputText value="Emp Id" />
										</f:facet>
										<h:outputText  value="#{employeeAttendance.employee.employeeCode}"/>
									</p:column>
									
                                   <p:column>
										<f:facet name="header">
											<h:outputText value="Employee Name" />
										</f:facet>
										<h:outputText value="#{employeeAttendance.employee.firstName} #{employeeAttendance.employee.lastName}"/>
									</p:column>
						         
									<p:column>
										<f:facet name="header">
											<h:outputText value="CL" />
										</f:facet>
										<h:outputText  value="#{employeeAttendance.CLBalance}"/>
									</p:column>
									<p:column>
										<f:facet name="header">
											<h:outputText value="SL" />
										</f:facet>
										<h:outputText  value="#{employeeAttendance.SLBalance}"/>
									</p:column>
									<p:column>
										<f:facet name="header">
											<h:outputText value="PL" />
										</f:facet>
										<h:outputText  value="#{employeeAttendance.PLBalance}"/>
									</p:column>
									<p:column>
										<f:facet name="header">
											<h:outputText value="WH" />
										</f:facet>
										<h:outputText  value="#{employeeAttendance.WHBalance}"/>
									</p:column>
									<p:column>
										<f:facet name="header">
											<h:outputText value="LOP" />
										</f:facet>
										<h:outputText  value="#{employeeAttendance.LOPBalance}"/>
									</p:column>
									<p:column>
										<f:facet name="header">
											<h:outputText value="COMP OFF" />
										</f:facet>
										<h:outputText  value="#{employeeAttendance.COMPOFFBalance}"/>
									</p:column>
									<p:column>
										<f:facet name="header">
											<h:outputText value="OH" />
										</f:facet>
										<h:outputText  value="#{employeeAttendance.OHBalance}"/>
									</p:column>
								
								
									
									
						</p:dataTable>	
							<p:commandButton value="Download as excel file" ajax="false" rendered="#{employeeLeaveBalances.RENDERTABLE}" style="float: right;">
							 <p:dataExporter target="leaveBalance" type="xls" fileName="EMPLEAVEBALANCES-#{employeeLeaveBalances.selectedMonth+1}-#{employeeLeaveBalances.selectedYear}"></p:dataExporter>
							</p:commandButton>
						<h:outputText value="No search results" style="color:red;font-style:bold;font-size:12px;" rendered="#{employeeLeaveBalances.RENDER_NO_RESULTS}"/>	
							
				</h:panelGrid>				
		  <p:growl id="growl"></p:growl>
		
		</h:form>
	</ui:define>
</ui:composition>
		